Skip to content

bugfix: Fix flaky dumpWithoutCrash instrumentation test on CI - #229

Merged
melekr merged 7 commits into
masterfrom
bugfix/fix-dumpWithoutCrash-ci-test
Nov 26, 2026
Merged

melekr merged 7 commits into
masterfrom
bugfix/fix-dumpWithoutCrash-ci-test

Conversation

@BartoszLitwiniuk

@BartoszLitwiniuk BartoszLitwiniuk commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Description:

dumpWithoutCrash failed intermittently on CI. It slept for a fixed time after tapping the button, queried Coroner once for Crash reports in that time window, and required exactly one result. On CI, native dump ingestion often takes longer than that sleep. Other Crash reports in the same window, from other tests or other devices in the same run, could also make the exact-count check fail or let the wrong report pass.

Changes

  • dumpWithoutCrash no longer sleeps and queries once. It now calls the existing CoronerNativeReportAssertions.awaitExactlyOneWithMessage. That helper polls Coroner for up to 90 s for reports that have this run's guid and error.message == "DumpWithoutCrash", and requires the report to be a Crash. It then waits 10 s and checks again, so a duplicate that arrives late fails the test.
  • MainActivity accepts a new EXTRA_REPORT_GUID intent extra. When it is set, the value goes into the guid attribute before Backtrace and its native integration start. Without the extra, the example app works as before.
  • ExampleInstrumentedTest makes one random GUID per instrumentation process and passes it through the activity rule. It is shared across tests, not per test, because Crashpad initializes once per process and ignores later re-initialization. Only the GUID from the first MainActivity launch reaches native reports. The message and timestamp filters keep tests apart.
  • Small cleanup: switched Assert.assertEquals to the statically imported assertEquals in the other tests in this file.

This addresses the review feedback: other Crash reports in the window, dumps from other devices, and duplicate dumps are now all rejected.

Only the example app changes (ExampleInstrumentedTest.java, MainActivity.java), there are no library code changes.

@BartoszLitwiniuk BartoszLitwiniuk changed the title Bugfix/fix dump without crash ci test bugfix: Fix flaky dumpWithoutCrash instrumentation test on CI Nov 16, 2026
@KishanPRao

Copy link
Copy Markdown
Contributor

Thanks for the changes!

Could we reuse CoronerNativeReportAssertions.awaitExactlyOneWithMessage instead?
The current query returns only one Crash report per poll. It doesn't cover:

  • other crash reports in the same window hiding the dump
  • a dump from another device in the same run passing the test
  • duplicate dumps

@BartoszLitwiniuk

Copy link
Copy Markdown
Collaborator Author

@KishanPRao thanks for your review! I've changed my code and now it's using awaitExactlyOneWithMessage.

@KishanPRao

Copy link
Copy Markdown
Contributor

The PR description needs to be updated with the latest changes.

@melekr
melekr merged commit 10ebb3c into master Nov 26, 2026
11 checks passed
@melekr
melekr deleted the bugfix/fix-dumpWithoutCrash-ci-test branch November 26, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants